<%-- 
    Document   : ThemSanPham
    Created on : Nov 19, 2012, 11:12:45 PM
    Author     : KaiLee
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<%
    String msg = (String) request.getParameter("msg");
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Thêm sản phẩm</title>
        <meta name="keywords" content="baby's day shop" />
        <meta name="description" content="Baby's day" />
        <link href="css/index_style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
       <div id="baby_wrapper_outter">
            <div id="baby_wrapper_inner">
                <jsp:include page="headerAdmin.jsp"/>
                <div id="baby_content_wrapper">

                    <jsp:include page="menuLeftAdmin.jsp"/>

                    <div id="baby_content">



                        <div id="them">
                            <form action="ThemSanPhamServlet" name="themsanpham"  onSubmit="return checkInput();">
                                <table>
                                    <tr><h2> Thông tin sản phẩm </h2></tr>
                                    <tr>
                                    <td width="30%">Mã sản phẩm</td>
                                    <td><input type="text" name="ma" /></td>
                                    </tr>
                                    <tr >
                                    <td width="30%">Tên sản phẩm:</td>
                                    <td> <input type="text" name="tenSanPham" size="30" maxlength="50"/></td>
                                    </tr>
                                    <tr >
                                    <td width="30%">Loại:</td>
                                    <td> <select width="50" name="Loai">
                                            <option> San pham be trai </option>
                                            <option> San pham be gai </option>
                                        </select> </td>

                                    </tr>
                                    <tr>
                                    <td width="30%">Nhà cung cấp:</td>
                                    <td>
                                        <select width="30" name="nhacungcap">
                                            <option>blue sky</option>
                                            <option>good day</option>
                                            <option>kids</option>
                                            <option>for u</option>
                                            <option>baby'day</option>

                                        </select>

                                    </td>
                                    </tr>

                                    <tr>
                                    <td width="30%">Giá:</td>
                                    <td><input type="text" name="gia"/></td>
                                    </tr>

                                    <tr>
                                    <td width="30%">Ảnh:</td>
                                    <td><input type="file" name="duongdan"/></td>
                                    </tr>

                                    <tr>
                                    <td width="30%">Số lượng: </td>
                                    <td><input type="text" name="soluong"/></td>
                                    </tr>

                                    <tr>
                                    <td width="30%">Mô tả</td>
                                    <td> <textarea name="mota" cols="40" rows="5"/></textarea> </td>
                                    </tr>

                                    <tr>
                                    <td><input type="submit" name="xacnhan"  value="Xác nhận thêm" /></td>
                                    <td><input type="reset" name="huybo" value="Huỷ bỏ"/></td>
                                    </tr>
                                </table>
                                <% if ((msg != null) && (msg.equals("1"))) {%>   

                                <SCRIPT language=JavaScript> 
                                    alert ("Mã sản phẩm bị trùng!");       
                                </SCRIPT> 

                                <p align="center"></p>  
                                <%}
                            if ((msg != null) && (msg.equals("2"))) {%>   

                                <SCRIPT language=JavaScript> 
                                    alert ("Nhập sai định dạng!");       
                                </SCRIPT> 

                                <p align="center"></p>  
                                <%}
                                %>    
                            </form>
                        </div>


                    </div>


                    <div class="cleaner"></div>


                </div> <!-- end of templatemo_content_wrapper -->

                <jsp:include page="footerAdmin.jsp"/>

            </div> <!-- end of templatemo_wrapper_inner -->

        </div> <!-- end of templatemo_wrapper_outter -->
    </body>
</html>

<SCRIPT language=JavaScript>
    function checkInput()
    {
        if (document.themsanpham.tenSanPham.value=="" || document.themsanpham.gia.value=="" || document.themsanpham.duongdan.value=="" || document.themsanpham.soluong.value=="" || document.themsanpham.soluong.value=="" || document.themsanpham.mota.value=="" || document.themsanpham.ma.value=="")
        {
            alert("Bạn hãy nhập đủ dữ liệu");   
            return false;
        }
       
        return true;
    }              
</script>